﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Collections;


namespace MoneyManagerNET.Presentation.Infrastructure.Binding
{
    public class NotifyableCollectionWrapper:IEnumerable,ICollectionNotificationRouter,IWrapper
    {

        public NotifyableCollectionWrapper(IEnumerable coll)
        {
            this.Instance = coll;
        }

        #region INotifyCollectionChanged Members

        public event NotifyCollectionChangedEventHandler CollectionChanged;

        #endregion

        #region INotifyableCollection Members

        public void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
        {
            if (CollectionChanged != null)
                CollectionChanged(this, args);
        }

        #endregion

        #region IWrapper Members

        public object Instance
        {
             get; set; 
        }

        #endregion

        #region IEnumerable Members

        public IEnumerator GetEnumerator()
        {
            return (Instance as IEnumerable).GetEnumerator();
        }

        #endregion
    }
}
